import { Component } from "@angular/core";
import { NavController,NavParams } from 'ionic-angular';
import { NativeStorage } from '@ionic-native/native-storage';
import { TranslateService } from '@ngx-translate/core';

import { PayPage } from "../../pay/pay";
@Component({
    selector: 'page-pay',
    templateUrl: 'houseChoose.html',
})

export class HouseChoosePage{
    type = 1;
    info:any;
    payPage=PayPage
    form={
        deposit: false,
        deposit_unit: "USD",
        other_price: false,
        other_unit: "USD",
        price: 0,
        price_unit: "USD",
        total_price: '0'
    };
    constructor(
        private navCtl: NavController,
        private navParams: NavParams,
        private stroge:NativeStorage,
        private translate: TranslateService,
    ) {
        translate.setDefaultLang('en')
        this.info = this.navParams.get('data');
    }
    ionViewDidEnter(){
        this.stroge.getItem('lang').then(res=>{
          this.translate.use(res)
        })
    }
    _unit(item){
        switch(item){
            case 'GBP':
                return '£';
            case 'EUR':
                return '€';
            case 'USD':
                return '$';
            case 'RMB':
                return '¥';
        }
    }
    gopay(){
        this.navCtl.push(this.payPage,{data:this.info})
    }
}